package main

import (
	"fmt"

	"gitee.com/dark.H/go-utils/s"
)

type S2 struct {
	Server string `ini:"server" default:"localhost:1080"`
	Name   string `ini:"name" default:"no name"`
	Pwd    string `ini:"pwd"`
	Port   int    `ini:"port" def:"80"`
	Can    bool   `ini:"can"`
}

func main1() {

	mp := s.Str("@ini.conf").ParseFileContent().ParseAsIniArg()
	c2 := new(S2)
	mp.DecodeAsStruct(c2)
	s.PrintlnStrcut(c2)

}

func main2() {
	c := &S2{
		Server: "115.23.asf.assf",
		Pwd:    "sdf",
	}
	s.ArgsFromINIStruct(c)

	s.PrintlnStrcut(c)
	if c.Can {
		fmt.Println(c.Name, c.Server, c.Port)

	}
}
